]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
magnifier: Do not modify function argument
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 19 Aug 2019 19:18:54 +0000 (21:18 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 15 Sep 2019 14:02:45 +0000 (16:02 +0200)
The intention of the code is clearly to operate on a copy, but that's
not how the Object constructor works. While it doesn't matter in
practice that we modify the passed-in object parameter, it's still
a good idea to fix the code.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731

js/ui/magnifier.js

index 73522586f3c55ac03834c4e2e574833d5ae175d7..0ec30ee00ee2f1cff396151a5db3990d3b765453 100644 (file)
@@ -264,7 +264,7 @@ var Magnifier = class Magnifier {
         zoomRegion.setViewPort(viewPort);
 
         // We ignore the redundant width/height on the ROI
-        let fixedROI = new Object(roi);
+        let fixedROI = Object.create(roi);
         fixedROI.width = viewPort.width / xMagFactor;
         fixedROI.height = viewPort.height / yMagFactor;
         zoomRegion.setROI(fixedROI);